flowboxchild: Use gtk_widget_measure to measure widget sizes
authorTimm Bäder <mail@baedert.org>
Fri, 17 Feb 2017 17:20:12 +0000 (18:20 +0100)
committerTimm Bäder <mail@baedert.org>
Fri, 17 Feb 2017 17:23:10 +0000 (18:23 +0100)
GtkFlowBoxChild is a simple GtkBin, so measure the child widget size in
a simple way.

gtk/gtkflowbox.c

index 9c496e8ef04ef2efbce306eb9fdc48031c4d0339..bd73e43d29c5f970e2758dda7ddef235b4edb935 100644 (file)
@@ -458,52 +458,8 @@ gtk_flow_box_child_measure (GtkCssGadget   *gadget,
       return;
     }
 
-  if (orientation == GTK_ORIENTATION_HORIZONTAL)
-    {
-      if (for_size < 0)
-        {
-          if (gtk_flow_box_child_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
-            {
-              gtk_widget_get_preferred_width (child, minimum, natural);
-            }
-          else
-            {
-              gint height;
-              gtk_widget_get_preferred_height (child, NULL, &height);
-              gtk_widget_get_preferred_width_for_height (child, height, minimum, natural);
-            }
-        }
-      else
-        {
-          if (gtk_flow_box_child_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
-            gtk_widget_get_preferred_width (child, minimum, natural);
-          else
-            gtk_widget_get_preferred_width_for_height (child, for_size, minimum, natural);
-        }
-    }
-  else
-    {
-      if (for_size < 0)
-        {
-          if (gtk_flow_box_child_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
-            {
-              gint width;
-              gtk_widget_get_preferred_width (child, NULL, &width);
-              gtk_widget_get_preferred_height_for_width (child, width, minimum, natural);
-            }
-          else
-            {
-              gtk_widget_get_preferred_height (child, minimum, natural);
-            }
-        }
-      else
-        {
-          if (gtk_flow_box_child_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
-            gtk_widget_get_preferred_height_for_width (child, for_size, minimum, natural);
-          else
-            gtk_widget_get_preferred_height (child, minimum, natural);
-        }
-    }
+  gtk_widget_measure (child, orientation, for_size,
+                      minimum, natural, minimum_baseline, natural_baseline);
 }
 
 static void